package com.blog.utils;

import lombok.Data;

/**
 * describe:数据返回封装
 *
 * @author vv
 * @date 2018/12/05/12:29
 */
@Data
public class R {

    private String code;
    private String msg;
    private Object data;

    /**
    *describe:
    *@author vv
    *@date 2018/12/5 12:29
    */
    public static R succ(String mess) {
        R m = new R();
        m.setCode("200");
        m.setData(null);
        m.setMsg(mess);

        return m;
    }

    /**
    *describe:
    *@author vv
    *@date 2018/12/5 12:30
    */
    public static R succ(String mess, Object data) {
        R m = new R();
        m.setCode("200");
        m.setData(data);
        m.setMsg(mess);

        return m;
    }

    /**
    *describe:
    *@author vv
    *@date 2018/12/5 12:38
    */
    public static R fail(String mess) {
        R m = new R();
        m.setCode("400");
        m.setData(null);
        m.setMsg(mess);

        return m;
    }

    /**
    *describe:
    *@author vv
    *@date 2018/12/5 12:56
    */
    public static R fail(String mess, Object data) {
        R m = new R();
        m.setCode("400");
        m.setData(data);
        m.setMsg(mess);

        return m;
    }
}

